﻿Use WarehouseManagement
Go

ALTER PROCEDURE GetCollectionRole
(
@IsShowAll bit=0
)
AS
BEGIN
	SELECT 
			r.[RoleID]
			, r.[RoleCode]
			, r.[RoleName]
			, r.[IsDelete]
			, r.[BriefDescription]
			, r.[FullDescription]
			, (
					SELECT 
							CAST(AuthorizationID AS VARCHAR(MAX)) + ',' 
					FROM 
							DefaultRoleAuthorization drax 
					WHERE 
							drax.RoleID = r.RoleID
					FOR XML PATH('') 
				) AS AuthorizationIDs
	FROM 
			[Role] r	
	WHERE
			r.[IsDelete] = 0 OR r.[IsDelete] = @IsShowAll
	
END

/*
USE WarehouseManagement
GO

EXEC GetCollectionRole
*/
